package com.rainsoft.center.isec.stream.library.controller;

import com.rainsoft.center.isec.stream.base.ABaseDataLoadToHBase;
import com.rainsoft.center.isec.stream.library.entity.hbase.BaseLibEntity;
import com.rainsoft.center.isec.stream.library.entity.hbase.impl.VidLoginout;

/**
 * @Name com.rainsoft.center.isec.stream.library.controller.BaseLibDataLoad
 * @Description
 * @Author Elwyn
 * @Version 2017/11/28
 * @Copyright 上海云辰信息科技有限公司
 **/
public class BaseLibDataLoad<T extends BaseLibEntity> extends ABaseDataLoadToHBase<T> {
	public BaseLibDataLoad(long duration, Class<T> aClass) {
		super(duration, aClass);
	}

	@Override
	public String generateRowKey(T t) {
		long time = t.getLoginTime().getTime() / 1000;
		if (t instanceof VidLoginout) {
			time = ((VidLoginout) t).getCaptime().getTime() / 1000;
		}
		return t.getIdcode() + "_" + t.getIdtype() + "_" + time;
	}
}
